<?php

class Ltt_Test extends CI_Controller{
    
    function __construct() {
        parent::__construct();
//        $this->load->library('session');
    }
    
    function demo(){
        if(!isset($_POST['username']))
            $data["username"]= "tungcsebk07";
        else
            $data["username"] = $this->input->post ('username');
        if(!isset($_POST['password']))
            $data["password"]= "12345";
        else
            $data['password']= $this->input->post ("password");
        if(!isset($_POST["email"]))
            $data["email"]= "lythanhtung.cse@gmail.com";
        else
            $data['email'] = $this->input->post('email');
        $data["domain"]= $this->config->item("base_url");
        $data["active_link"] = anchor($this->config->item('base_url')."/".$this->config->item("index_page")."/ltt_test/demo");
        $data["cancel_link"] = anchor($this->config->item('base_url')."/".$this->config->item("index_page")."/ltt_test");
        
        $this->load->library('../controllers/ltt_email_c');
        $activew = new $this->ltt_email_c();
        $activew->set_data($data);
        $activew->send_active();
    }
    function index(){
        
        echo "<center><b>REGISTRY</b>";
        $this->load->helper('form');
        echo form_open('ltt_test/demo');
        echo form_label('Username: ').form_input(array('name'=>'username','style={width:100px; color:red;}'));
        echo '<br>';
        echo form_label('Password: '). form_password(array('name'=>'password','style={width:100px;}'));
        echo '<br>';
        echo form_label('Email: '). form_input(array('type'=>'email','name'=>'email','style={width:100px;}'));
        echo '<br>';
        echo form_submit(array('name'=>'login','value'=>'Send to email'));
        echo form_close();
        echo "</center>";
        
        //------------
         
        $this->load->library('../controllers/social/facebook');
//        $this->afacebook->login();
    }
    
    function ban_user(){
        $data["email"] = "lythanhtung.cse@gmail.com";
        $data["username"] = "challana";
        $data["reason"] = "Ve que thuong xuyen";
        $data["contact"] = "sdt: 099894328";
        $this->load->library("../controllers/ltt_email_c");
        $send_ban = new $this->ltt_email_c;
        $send_ban->set_data($data);
        $send_ban->send_ban();
    }
    function remind(){
        $data["email"] = "lythanhtung.cse@gmail.com";
        $this->load->library("../controllers/ltt_email_c");
        $send_ban = new $this->ltt_email_c;
        $send_ban->set_data($data);
        $send_ban->send_remind();
    }
    
    function new_pass(){
        $data["email"] = "lythanhtung.cse@gmail.com";
        $this->load->library("../controllers/ltt_email_c");
        $send_ban = new $this->ltt_email_c;
        $send_ban->set_data($data);
        $send_ban->send_reset_password();
    }
    
    function testsession(){
        echo $this->session->userdata('session_id');
        echo "<p>";
        echo $this->session->userdata('ip_address');
        echo "<p>";
        echo $this->session->userdata('user_agent');
        echo "<p>";
        echo $this->session->userdata('last_activity');
    }
    
    function logout(){
        
    }
    function sendmail(){
        $data['email'] = "lythanhtung.cse@gmail.com";
        $data['subject'] = "tieu de";
        $data['message'] = "Nội dung";
        $this->load->library('../controllers/ltt_email_c');
        $email = new $this->ltt_email_c();
        $email->set_data($data);
        $email->send();
    }
}
